using System;
using System.Data;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Text;

namespace NNFramework.NeuroLibrary
{
    public static class clsErrorFx<TMainInput, TNConnect, TMainOutput>
        where TMainInput : struct
        where TNConnect : struct
        where TMainOutput : struct
    {
        public static double BasicErrorFx(clsNetwork<TMainInput, TNConnect, TMainOutput> pntkNetwork)
        {
            double dblResult = 0;
            double dblRow = 0;
            for (int i = 0; i < pntkNetwork.Examples.Rows.Count; i++)
            {
                for (int j = 0; j < pntkNetwork.Examples.Columns.Count; j++)
                {
                    dblRow += Convert.ToDouble(pntkNetwork.Examples.Rows[i][j]) - Convert.ToDouble(pntkNetwork.CurrentOutputs[j]);                    
                }
                dblResult += (dblRow / pntkNetwork.Examples.Columns.Count);
            }
            dblResult /= pntkNetwork.Examples.Rows.Count;
            return dblResult * 100;
        }
        
    }
}
